Instance 0

Class60.transferFileToPublicServer(String kmlFileName,File file)#2{
      inStream = new DataInputStream(conn.getInputStream());
      while ((str = inStream.readLine()) != null) {
        if (str.equalsIgnoreCase("done")) {
          logger.info("Transfer complete.");
          inStream.close();
          return true;
        else
          return false;
      }
      inStream.close();
}


Instance 1

Class70.grabPage(String url)#1{
      u = new URL(url);
      is = u.openStream();
      dis = new DataInputStream(new BufferedInputStream(is));
      while ((s = dis.readLine()) != null) {
        result.append(s).append("\n");
      }
      if (dis != null)
        dis.close();
      if (is != null)
        is.close();
}


Instance 2

Class100.testRead(String filename){
    DataInputStream in = new DataInputStreamnew BufferedInputStream(new FileInputStream(filename)));
    while (null != (line = in.readLine())) {
      System.out.println("Line "+count++);
      System.out.println(line);
      System.out.println(showBytes(line.getBytes(CDM.utf8Charset)));
    }
    in.close();
}


Instance 3

Class90.load(InputStream inStream)#1{
    DataInputStream reader = new DataInputStream(inStream);
    while ((line = reader.readLine()) != null)
      {
        char c = 0;
        int pos = 0;
        // Leading whitespaces must be deleted first.
        while (pos < line.length()
               && Character.isWhitespace(c = line.charAt(pos)))
          pos++;

        // If empty line or begins with a comment character, skip this line.
        if ((line.length() - pos== 0
            || line.charAt(pos== '#' || line.charAt(pos== '!')
          continue;

        // The characters up to the next Whitespace, ':', or '='
        // describe the key.  But look for escape sequences.
        // Try to short-circuit when there is no escape char.
        int start = pos;
        boolean needsEscape = line.indexOf('\\', pos!= -1;
        StringBuilder key = needsEscape ? new StringBuilder() null;
        while (pos < line.length()
               && ! Character.isWhitespace(c = line.charAt(pos++))
               && c != '=' && c != ':')
          {
            if (needsEscape && c == '\\')
              {
                if (pos == line.length())
                  {
                    // The line continues on the next line.  If there
                    // is no next line, just treat it as a key with an
                    // empty value.
                    line = reader.readLine();
                    if (line == null)
                      line = "";
                    pos = 0;
                    while (pos < line.length()
                           && Character.isWhitespace(c = line.charAt(pos)))
                      pos++;
                  }
                else
                  {
                    c = line.charAt(pos++);
                    switch (c)
                      {
                      case 'n':
                        key.append('\n');
                        break;
                      case 't':
                        key.append('\t');
                        break;
                      case 'r':
                        key.append('\r');
                        break;
                      case 'u':
                        if (pos + <= line.length())
                          {
                            char uni = (charInteger.parseInt
                              (line.substring(pos, pos + 4)16);
                            key.append(uni);
                            pos += 4;
                          }        // else throw exception?
                        break;
                      default:
                        key.append(c);
                        break;
                      }
                  }
              }
            else if (needsEscape)
              key.append(c);
          }

        boolean isDelim = (c == ':' || c == '=');

        String keyString;
        if (needsEscape)
          keyString = key.toString();
        else if (isDelim || Character.isWhitespace(c))
          keyString = line.substring(start, pos - 1);
        else
          keyString = line.substring(start, pos);

        while (pos < line.length()
               && Character.isWhitespace(c = line.charAt(pos)))
          pos++;

        if (! isDelim && (c == ':' || c == '='))
          {
            pos++;
            while (pos < line.length()
                   && Character.isWhitespace(c = line.charAt(pos)))
              pos++;
          }

        // Short-circuit if no escape chars found.
        if (!needsEscape)
          {
            put(keyString, line.substring(pos));
            continue;
          }

        // Escape char found so iterate through the rest of the line.
        StringBuilder element = new StringBuilder(line.length() - pos);
        while (pos < line.length())
          {
            c = line.charAt(pos++);
            if (c == '\\')
              {
                if (pos == line.length())
                  {
                    // The line continues on the next line.
                    line = reader.readLine();

                    // We might have seen a backslash at the end of
                    // the file.  The JDK ignores the backslash in
                    // this case, so we follow for compatibility.
                    if (line == null)
                      break;

                    pos = 0;
                    while (pos < line.length()
                           && Character.isWhitespace(c = line.charAt(pos)))
                      pos++;
                    element.ensureCapacity(line.length() - pos +
                                           element.length());
                  }
                else
                  {
                    c = line.charAt(pos++);
                    switch (c)
                      {
                      case 'n':
                        element.append('\n');
                        break;
                      case 't':
                        element.append('\t');
                        break;
                      case 'r':
                        element.append('\r');
                        break;
                      case 'u':
                        if (pos + <= line.length())
                          {
                            char uni = (charInteger.parseInt
                              (line.substring(pos, pos + 4)16);
                            element.append(uni);
                            pos += 4;
                          }        // else throw exception?
                        break;
                      default:
                        element.append(c);
                        break;
                      }
                  }
              }
            else
              element.append(c);
          }
        put(keyString, element.toString());
      }
}


Instance 4

Class0.run()#2{
                DataInputStream ds = new DataInputStream(serverInput);
                while ((s = ds.readLine()) != null) {
                    int len = s.length();
                    while (len > && s.charAt(len - 1<= ' ')
                        len--;
                    if (len <= 0)
                        continue;
                    int key = s.charAt(0);
                    int t1 = s.indexOf('\t');
                    int t2 = t1 > ? s.indexOf('\t', t1 + 1: -1;
                    int t3 = t2 > ? s.indexOf('\t', t2 + 1: -1;
                    if (t3 < 0) {
                        // ps.print("<br><i>"+s+"</i>\n");
                        continue;
                    }
                    String port = t3 + < len ? ":" + s.substring(t3 + 1, len"";
                    String host = t2 + < t3 ? s.substring(t2 + 1, t3: u.getHost();
                    ps.print("<dt><a href=\"gopher://" + host + port + "/"
                             + s.substring(01+ encodePercent(s.substring(t1 + 1, t2)) "\">\n");
                    ps.print("<img align=middle border=0 width=25 height=32 src=");
                    switch (key) {
                      default:
                        ps.print(System.getProperty("java.net.ftp.imagepath.file"));
                        break;
                      case '0':
                        ps.print(System.getProperty("java.net.ftp.imagepath.text"));
                        break;
                      case '1':
                        ps.print(System.getProperty("java.net.ftp.imagepath.directory"));
                        break;
                      case 'g':
                        ps.print(System.getProperty("java.net.ftp.imagepath.gif"));
                        break;
                    }
                    ps.print(".gif align=middle><dd>\n");
                    ps.print(s.substring(1, t1"</a>\n");
                }
                ps.print("</dl></body>\n");
                ps.close();
}


Instance 5

Class100.downloadURL(String theURL)#0{
      u = new URL(theURL);
      is = u.openStream();
      dis = new DataInputStream(new BufferedInputStream(is));
      while ((s = dis.readLine()) != null)
        sb.append(s + "\n");
        if (is != null)
          is.close();
}


Instance 6

Class110.GetNewCards()#0{
                urlConn = url.openConnection();
                urlConn.setDoInput (true);
                urlConn.setUseCaches (false);
                urlConn.addRequestProperty("Cookie", EASW_KEY+";"+PhishingKey);
                input = new DataInputStream (urlConn.getInputStream ());
                while (null != (str = input.readLine()))
                {
                   returnStr.append(str);
                }
                input.close ();
}


Instance 7

Class50.getTrade(int TradeID)#2{
                urlConn = url.openConnection();
                urlConn.setDoInput (true);
                urlConn.setUseCaches (false);
                urlConn.addRequestProperty("Cookie", EASW_KEY+";"+PhishingKey);
                input = new DataInputStream (urlConn.getInputStream ());
                while (null != (str = input.readLine()))
                {
                   returnStr.append(str);
                }
                input.close ();
}


Instance 8

Class20.getStreamLines(final InputStream is)#1{
      final DataInputStream dis = new DataInputStream(is);
        if (dis.available() 0) {
          buffer = new StringBuffer(dis.readLine());
          while (dis.available() 0) {
            buffer.append("\n").append(dis.readLine());
          }
        }
        dis.close();
}


Instance 9

Class70.getStreamLines(final InputStream is)#0{
            DataInputStream dis = new DataInputStream(is);
                if (dis.available() 0) {
                    //noinspection deprecation
                    buffer = new StringBuffer(dis.readLine());
                    while (dis.available() 0) {
                        //noinspection deprecation
                        buffer.append('\n').append(dis.readLine());
                    }
                }
                dis.close();
}


Instance 10

Class20.movePlayer(String itemID,String pile)#1{
        input = new DataInputStream (urlConn.getInputStream ());
        while (null != (str = input.readLine()))
        {
            returnStr.append(str);
         }
         input.close ();
}


Instance 11

Class10.readLatinOneFileLines(File file)#0{
    new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
   while ((str = infile.readLine()) != null)
    lines.addElement(str);
   infile.close();
}


Instance 12

Class30.buyPack(int packId,String payForIt)#1{
                input = new DataInputStream (urlConn.getInputStream ());
                while (null != (str = input.readLine()))
                {
                   returnStr.append(str);
                }
                input.close ();
}


Instance 13

Class50.searchTraining(String level,String type,int start,int count,int MaxB)#0{
                urlConn = url.openConnection();
                urlConn.setDoInput (true);
                urlConn.setUseCaches (false);
                urlConn.addRequestProperty("Cookie", EASW_KEY+";"+PhishingKey);
                input = new DataInputStream (urlConn.getInputStream ());
                while (null != (str = input.readLine()))
                {
                   returnStr.append(str);
                }
                input.close ();
}


Instance 14

Class100.run()#1{
        DataInputStream in = new DataInputStream(p.getInputStream());
        while ((line = in.readLine()) != null)
            pw.println(line);
            in.close();
}


Instance 15

Class30.buyTokens()#1{
                input = new DataInputStream (urlConn.getInputStream ());
                while (null != (str = input.readLine()))
                {
                   returnStr.append(str);
                }
                input.close ();
}


Instance 16

Class90.tradeOffer(int tradeID,int amount,Collection<String> playerIDs)#1{
                input = new DataInputStream (urlConn.getInputStream ());
                while (null != (str = input.readLine()))
                {
                   returnStr.append(str);
                }
                input.close ();
}


Instance 17

Class110.search(int start,int count,String level,String formation,String position,int nationality,int league,int team,int minBid,int maxBid,int minBIN,int maxBIN)#2{
                urlConn = url.openConnection();
                urlConn.setDoInput (true);
                urlConn.setUseCaches (false);
                urlConn.addRequestProperty("Cookie", EASW_KEY+";"+PhishingKey);
                input = new DataInputStream (urlConn.getInputStream ());
                while (null != (str = input.readLine()))
                {
                   returnStr.append(str);
                }
                input.close ();
}


Instance 18

Class50.buy(int tradeID,int amount,String playerName)#1{
                input = new DataInputStream (urlConn.getInputStream ());
                while (null != (str = input.readLine()))
                {
                   returnStr.append(str);
                }
                input.close ();
}


Instance 19

Class30.postTrade(String itemID,int startBid,int buyNow,int duration)#2{
        input = new DataInputStream (urlConn.getInputStream ());
        while (null != (str = input.readLine()))
        {
            returnStr.append(str);
         }
         input.close ();
}


Instance 20

Class70.main(String[] args)#0{
    FileInputStream inputFile = new FileInputStream(kms.filename);
    while ((n = inputFile.read(b)) != -1) {
      for (int i = 0; i < n; i++) {
        if (b[i== '\n')
          numObjects++;
      }
    }
    inputFile.close();
    inputFile = new FileInputStream(kms.filename);
    if((line = new DataInputStream(inputFile).readLine()) != null) {
      int index = 0;
      boolean prevWhiteSpace = true;
      while(index < line.length()) {
        char c = line.charAt(index++);
        boolean currWhiteSpace = Character.isWhitespace(c);
        if(prevWhiteSpace && !currWhiteSpace){
          numAttributes++;
        }   
        prevWhiteSpace = currWhiteSpace;
      }   
    }   
    inputFile.close();
    KMeans.readFromFile(inputFile, kms.filename, buf, MAX_LINE_LENGTH);
}


Instance 21

Class100.doFileUpload(String file_path)#4{
      inStream = new DataInputStream(conn.getInputStream());
      while ((str = inStream.readLine()) != null) {
        Log.e("doFileUpload""Server Response" + str);
      }
      inStream.close();
}


Instance 22

Class40.run()#0{
                DataInputStream input = new DataInputStream(connection.getInputStream());
                while (null != ((response = input.readLine()))) {
                    System.err.println(response);
                }
                input.close();
}


Instance 23

Class60.runJavah()#1{
        DataInputStream in = new DataInputStream(p.getInputStream());
        while ((line = in.readLine()) != null)
            System.err.println(line);
            in.close();
}


Instance 24

Class100.readLegacySites(InputStream input)#0{
        DataInputStream dis = new DataInputStream(input);
        while ((line = dis.readLine()) != null) {
            int eq = line.indexOf('=');
            if (eq != -1) {
                String name = line.substring(0, eq);
                String url = line.substring(eq + 1);
                if (Util.isValidURL(url)) {
                    sites.add(new Subscription(name, url));
                else {
                    TraceUtil.report(new RuntimeException("invalid URL in line: '" + line + "'; URL was: " + url));
                // endif

            else {
                TraceUtil.report(new RuntimeException("missing equals in line: " + line));
            }
        }
}


Instance 25

Class100.readMaze(String inputFileName)#4{
            while((line = new DataInputStream(in).readLine()) != null) {
                
                String code;
                int[] xy = new int[6];  // equivalent to x1,y1,z1,x2,y2,z2
                int numToken = 0;
                
                StringTokenizer tok = new StringTokenizer(line);

                if((numToken = tok.countTokens()) ) {
                    continue;
                }

                code = tok.nextToken();

                if(code.equals("#")) {
                    /* comment line */
                    continue;
                }
                for(int i=0;i<numToken-1;i++) {
                    xy[i= Integer.parseInt(tok.nextToken());
                }

                if(code.equals("d")) {
                      /* dimensions (format: d x y z) */
                     if(numToken != 4) {
                        isParseError = true;
                     }
                     else {
                        width = xy[0];
                        height = xy[1];
                        depth = xy[2];
                        if(width < || height < || depth <1)
                            isParseError = true;
                     }
                 }else if(code.equals("p")) { /* paths (format: p x1 y1 z1 x2 y2 z2) */
                    if(numToken != 7) {
                        isParseError = true;
                    }
                    else {
                        Coordinate srcPtr = Coordinate.alloc(xy[0],xy[1],xy[2]);
                        Coordinate dstPtr = Coordinate.alloc(xy[3],xy[4],xy[5]);

                        if(Coordinate.isEqual(srcPtr,dstPtr)) {
                            isParseError = true;
                        }
                        else 
                            Pair coordinatePairPtr = Pair.alloc(srcPtr,dstPtr);
                            boolean status = workListPtr.insert(coordinatePairPtr);
                            srcVectorPtr.vector_pushBack(srcPtr);
                            dstVectorPtr.vector_pushBack(dstPtr);
                            
                        }
                    }
                }else if(code.equals("w")) {
                         /* walls (format: w x y z) */
                        if(numToken != 4) {
                            isParseError = true;
                        else {
                            Coordinate wallPtr = Coordinate.alloc(xy[0],xy[1],xy[2]);
                            wallVectorPtr.vector_pushBack(wallPtr);
                        }
                }else /* error */
                       isParseError = true;
                }
                
                if(isParseError)  {/* Error */
                    System.out.println("Error: line " + lineNumber + " of " + inputFileName + "invalid");
                    System.exit(1);
                }
            }
            in.close();
}


Instance 26

Class70.readConfiguration(File file)#1{
            fis = new FileInputStream(file);
            bis = new BufferedInputStream(fis);
            dis = new DataInputStream(bis);
            while (dis.available() != 0) {

                // this statement reads the line from the file and print it to
                // the console.
                buff.append(dis.readLine()).append("\n");
            }
            fis.close();
}


Instance 27

Class50.readAsString(String filename,String newLineString)#0{
        File file = new File(filename);
        FileInputStream fis = new FileInputStream(file);
        BufferedInputStream bis = new BufferedInputStream(fis);
        DataInputStream dis = new DataInputStream(bis);
        while (dis.available() != 0) {
            sb.append((new StringBuilder()).append(dis.readLine()).append(newLineString));
        }
        fis.close();
}


Instance 28

Class90.loadMeta(File current)#5{
    if (order.exists()) {
      try {
        DataInputStream dis = new DataInputStream(new FileInputStream(order));
        String line = null;
        while ((line = dis.readLine()) != null) {
          File file = config.getPodcastRootPath(line);
          if (file.exists()) {
            metas.add(new MetaFile(file));
                                                if currentName != null && currentName.equals(file.getName()) )
                                                {
                                                   currentIndex = metas.size() 1;
                                             Log.d("CarCast""currentIndex: " + currentIndex);
                                                }
          }
        }
      catch (IOException e) {
        Log.e("CarCast""reading order file", e);
      }
    }
}


Instance 29

Class80.isUrlReachable(String url)#1{
            downloadUrl = new URL(url);
            is = downloadUrl.openStream();
            dataInputStream = new DataInputStream(new BufferedInputStream(is));
            while (dataInputStream.readLine() != null) {
                return true;
            }
}


Instance 30

Class80.read(String filename)#0{
        File file = new File(filename);
        FileInputStream fis = new FileInputStream(file);
        BufferedInputStream bis = new BufferedInputStream(fis);
        DataInputStream dis = new DataInputStream(bis);
        while(dis.available() != 0){
            output.add(dis.readLine());
        }
        fis.close();
}


Instance 31

Class80.main(String[] args)#0{
            FileInputStream fis = new FileInputStream(args[0]);
            DataInputStream dis = new DataInputStream(fis);
            while ((line = dis.readLine()) != null) {
                if (isWindows) {
                    line = line.replace('/', File.separatorChar);
                }
                roots.add(line);
            }
}


Instance 32

Class20.connect()#0{
               input = new DataInputStream (urlConn.getInputStream ());
                while (null != ((str = input.readLine())))
                {
                }
                Map<String,List<String>> cm = urlConn.getHeaderFields();
                List<String> cl = cm.get("Set-Cookie");
}


Instance 33

Class30.readNotify()#1{
                    DataInputStream din = new DataInputStream(in);
                    while ((line = din.readLine()) != null)
                        message += line + lineSeparator;
}


Instance 34

Class70.exec(Tuple input)#1{
            DataInputStream in = fs.open(new Path(lookupFile));
            while ((line = in.readLine()) != null) {
                String[] toks = new String[2];
                toks = line.split(":"2);
                lookup.put(toks[0], toks[1]);
            }
            in.close();
}


Instance 35

Class40.addFile(File qf)#0{
    while (dis.available() != 0) {
      qsb.append(dis.readLine() "\n");
    }
    qMap.put(qf.getName(), qsb.toString());
}


Instance 36

Class90.ThemeMap(File file)#0{
    while (dataStream.available() != 0) {
      lines.add(dataStream.readLine());
    }
    fileStream.close();
}


Instance 37

Class110.upload(String file,String server,final String fileKey,final String fileName,final String mimeType,JSONObject params,boolean trustEveryone)#13{
    while (( line = inStream.readLine()) != null) {
      responseString.append(line);
    }
    System.out.println(responseString.toString());
}


Instance 38

Class70.getHadoopMultiUsersList()#1{
    while((strLine = disObj.readLine()) != null){
      usersList.add(strLine.substring(0,strLine.indexOf(',')));
    }
}


Instance 39

Class30.ping(String hostname)#2{
      while ((line = stdout.readLine()) != null) {
        pingResult = line;
        tmr.cancel();
        process.destroy();
        return pingResult;
      }
      process.waitFor();
}


Instance 40

Class90.testReadSpeed(File f)#8{
        while (dis.readLine() != null) {
        }
}


Instance 41

Class100.run()#1{
                while (((line = in.readLine()) != null&& !line.equals("."&& isRunning()) {
                    System.out.println("Readed from socket: " + line);
                    parseInput(line);
                }
                System.out.println("Closing socket connection " + server.getInetAddress());
                server.close();
}


Instance 42

Class0.runAsRoot(String command)#0{
      String line = new String();
      while ((line = is.readLine()) != null) {
        output = output + line;
      }
}


Instance 43

Class0.launchFromInstalledGosu(String jarLoc,String strProgram)#2{
      while( (strLine = errIn.readLine()) != null ) {
        writer.writestrLine + "\n" );
      }
      writer.flush();
      writer.close();
}